package com.cai.activiti_demo1.controller;

import com.cai.activiti_demo1.schedule.DataSchedule;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DeploymentController {
    @Autowired
    DataSchedule dataSchedule;

    /**
     * 部署
     */
    @GetMapping("/deploy")
    public String deploy(){
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        Deployment deployment = processEngine
                .getRepositoryService()
                .createDeployment().name("测试服务任务")
                .addClasspathResource("flow/demo/DemoEvent1.bpmn20.xml")
                .deploy();
        return "部署成功";
    }

    @GetMapping("/cache")
    public String getValue(){
        return "";
    }
}
